<!DOCTYPE html>
<html>

<head>
    <metacharset="UTF-8">
        <title>v-for指令</title>
</head>

<body>
    <div id="app">
        <li v-for="n in evenNumbers" :key="n">{{ n }}</li>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.2/vue.global.prod.js"></script>
    <script>
        const vm = Vue.createApp({
            data() {
                return {
                    numbers: [1, 2, 3, 4, 5]
                }
            },
            computed: {
                evenNumbers() {
                    return this.numbers.filter(number => number % 2 === 0)
                }
            }
        }).mount('#app');
    </script>
</body>

</html>